1. Field of the Invention
The present invention relates to a recovery method using the combination of deferred-update and shadow page schemes and a storage system including the method.
2. Description of the Related Art
Recently, as the computer technology advances, the amount of data that are being stored and managed in the digital form is increasing rapidly. Accordingly, database management systems that are capable of storing and managing data efficiently are employed in various fields.
A ‘storage system’ is a core software corresponding to a low-level component of a database management system. It has a direct and important influence on the performance of database application programs. Such a storage system is responsible for the functions of storing and managing data in a disk, the transaction function, the concurrency control function, and the crash recovery function. Among these functions, the crash recovery function is used to prevent loss of data consistency that may occur due to various errors in the computer system.
There are two frequently used techniques for crash recovery in a storage system: 1) a deferred update technique and 2) a shadow page technique.
In the deferred update technique, storing a page in the buffer (a buffer page) that has been updated into the database on the disk is deferred until a transaction is committed. Here, when an updated buffer page needs to be stored in the disk, the updated buffer page is first stored in a deferred update file on the disk until a transaction is committed. Thus, the process of aborting a transaction is performed in such a way as to delete the deferred update file without an additional undo process because updated buffer pages have not been reflected in the database.
The process of committing a transaction is as follows. The updated buffer pages on a memory are first written (swapped out) to the deferred update file, and then, the updated pages stored in the deferred update file are reflected into the database. This two-step process is for being able to redo a transaction when a system failure occurs after storing the updated buffer pages into the deferred update file.
The deferred update technique has an advantage that disk access performance is not aggravated since the original location of the updated page in the database is not changed, and thus, logically related data remain clustered. However, it has a disadvantage that, since the updated data are not immediately reflected in the database; queries are executed on the database in which the updated data have not been reflected, and thus, the query results could be incorrect. This problem can be solved by designing a system to process a query in such a way as to access not only the database but also the deferred update file when the query is executed. However, this solution increases the complexity of the system because it must additionally access the deferred update file, as described above.
On the other hand, in the shadow page technique, an updated buffer page is directly stored into the database on the disk. Here, the original page (the page before being updated) in the database is left as a shadow page, and the updated buffer page is instead stored in the page that is newly allocated in the database. This technique uses two page tables—the shadow page table and the current page table—in order to manage pages in the database. Here, the page table is an index that returns the position of the page to be read in the disk. The process of starting a transaction (BEGIN) is performed by duplicating the page table (the original page table is called ‘the shadow page table’ and the duplicated page table ‘the current page table’). When an updated buffer page needs to be stored in the disk during a transaction, the updated buffer page is stored in the page that is newly allocated in the database, and the current page table points to the newly allocated page. Thereafter, when reading a page that does not exist in the buffer from the database, a page that has been updated recently is accessed by using the current page table. The process of aborting a transaction (ABORT) is performed by deleting the updated pages and the current page table, and then restoring to the shadow page table. The process of committing a transaction (COMMIT) is performed by swapping out the updated buffer pages to the database and then making the current page table to be the shadow page table.
As described above, in the shadow page technique, the updated buffer page is stored in the database. Accordingly, the shadow page technique has less system complexity compared with the deferred update technique because it processes a query considering only the database (i.e., without considering the deferred update file as well) when the query is executed. However, when a page in the database is updated, the page is stored at a new position, rather than at the position of the original page. Thus, disk access performance is degraded because the clustering of logically related data is compromised.